import time
import os
from selenium import webdriver
from selenium.webdriver.common.by import By


class Alter:
    def __init__(self):
        self.driver = webdriver.Chrome()
        self.driver.maximize_window()
        url = 'file:///' + os.path.abspath("../代码练习/html") + '/abc.html'
        self.driver.get(url)

    def action(self):
        self.driver.find_element(By.ID,'alert').click()

    def quit(self, second=3):
        time.sleep(second)
        self.driver.quit()


if __name__ == '__main__':
    alter = Alter()
    alter.action()
    alter.quit()